<template>
  <div class="bbs-classify">
    <el-tag
      class="classify-item"
      :effect="current == item.id ? 'dark' : 'plain'"
      v-for="item in tableData"
      :key="item.id"
      @click="handleClassify(item)"
    >
      {{ item.name }}
    </el-tag>
  </div>
</template>
<script>
export default {
  data() {
    return {
      listQuery: {
        page: 1,
        limit: 9999,
        pid: 0,
        classType: '5', //1.试卷 2.考试 3.栏目 4.错题集 5论坛
        status: '1',
      },
      tableData: [],
      current: '',
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    async getList() {
      let res = await this.$store.dispatch('sysClassifyList', this.listQuery)
      this.tableData = res.data
      let total = { id: '', name: '全部' }
      this.tableData.unshift(total)
    },
    handleClassify(row) {
      this.current = row.id
      this.$emit('e-emit', row.id)
    },
  },
}
</script>
<style scoped lang="scss">
.bbs-classify {
  padding: 10px;
  margin-bottom: 20px;
  border-radius: 5px;
  background-color: #ecf5ff50;
  .classify-item {
    margin-right: 10px;
    cursor: pointer;
  }
}
</style>